package seven;

public class 七三字符串 {

    public static void main(String[] args) {
        String s1 = new String("abcdef");
        String s2 = s1.substring(2, 4);
        // 打印：ab199863
        System.out.println(Integer.toHexString(s1.hashCode()));
        // 打印：c61, 显然s1和s2不是同一个对象
        System.out.println(Integer.toHexString(s2.hashCode()));


        String str1 = "hello" + " java";
        String str2 = "hello java";
        System.out.println(str1 == str2);
        String str3 = "hello";
        String str4 = " java";
        String str5 = str3 + str4;
        System.out.println(str2 == str5);
        System.out.println(str2.equals(str5));

    }
}
